﻿Public Class AccordionTabs
    Inherits System.Collections.CollectionBase

    Public Sub Add(ByVal TabToAdd As AccordionTab)
        Try
            List.Add(TabToAdd)
        Catch ex As Exception
            '
            'TODO: Error Handling
            '
        End Try
    End Sub

    Public Sub Remove(ByVal IndexOfTabToRemove As Integer)
        Try
            If IndexOfTabToRemove > Count - 1 Or IndexOfTabToRemove < 0 Then
                Throw New Exception("An invalid index was given for the Tab to remove.")
            Else
                List.RemoveAt(IndexOfTabToRemove)
            End If
        Catch ex As Exception
            '
            'TODO: Error Handling
            '
        End Try
    End Sub

    Default Public ReadOnly Property Item(ByVal IndexOfTabToRetrieve As Integer) As AccordionTab
        Get
            Try
                If IndexOfTabToRetrieve > Count - 1 Or IndexOfTabToRetrieve < 0 Then
                    Throw New Exception("An invalid index was given for the Tab to retrieve.")
                Else
                    Return CType(List.Item(IndexOfTabToRetrieve), AccordionTab)
                End If
            Catch ex As Exception
                '
                'TODO: Error Handling
                '
                Return Nothing
            End Try
        End Get
    End Property
End Class
